import axios from "axios";

const basUrl = 'https://api.it120.cc/'

export function get(url) {
  return function(params = {}) {
    return axios.get(basUrl + url, {
      params
    }).then(res => {
      const { code, data } = res.data
      if (code === 0) {
        return data
      }
    }).catch(err => {
      console.log(err);
    })
  }
}
export function post(url,params) {
  return function(params1 = params) {
    return axios.post(basUrl + url+  params1
    ).then(res => {
      const { code, data } = res.data
      if (code === 0) {
        return data
      }
    }).catch(err => {
      console.log(err);
    })
  }
}